File Dialog:
Java provides a Built in dialog box that lets the user specify a file.
FileDialog(Frame,string)
FileDialog(frame,string,int how)
FileDialog(frame)
how=FileDialog.LOAD,FileDialog.SAVE
string getDirectory( )
string getFile( )

 

 

 

WRITE A PROGRAM ON FILE DILOG.

import java.awt.*;
import java.awt.event.*;

//create a subclass of frame
class SampleFrame extends Frame
{
SampleFrame(String title)
{
super(title);
//create an object to handle window events
MyWindowAdapter adapter=new MyWindowAdapter(this);
//register it to recevie those events
addWindowListener(adapter);
}
}
class MyWindowAdapter extends WindowAdapter
{
 SampleFrame sampleFrame;
public MyWindowAdapter(SampleFrame sampleFrame)
{
this.sampleFrame=sampleFrame;
}
public void windowClosing(WindowEvent we)
{
sampleFrame.setVisible(false);
}
}
//create frame window.
class Filed
{
public static void main(String args[])
{
Frame f=new SampleFrame("File Dialog Demo");
f.setVisible(true);
f.setSize(100,100);
FileDialog fd=new FileDialog(f,"File Dialog");
fd.setVisible(true);
}
}

 

 

 

SFiledialog